<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div{
      width: 100px;
      height: 100px;
      background-color: aqua;
    }
  </style>
</head>
<body>
<button>点击随机点名</button>
<div></div>
<script>
  var button = document.querySelector('button')
  var div = document.querySelector('div')
  var nu = ['张三','李飞','老刘','小明','小红']
  button.addEventListener('click',function(){
    div.innerText = nu[getRandomInt(0,4)]
  })
  function getRandomInt(min,max){
    min = Math.ceil(min)
    max = Math.floor(max)
    return Math.floor(Math.random() * (max - min + 1)) + min;
  }
</script>
</body>
</html>